<%--

<!--------------------------------------------------------------------------------------------------------------------------------
 - Copyright 2007 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   MASTER_DEPARTMENT
 - AUTHOR           :   Ray Guo 
 - DATE CREATE      :   2007/07/11
 - DESCRIPTION      :   a SEARCH CONTENT JSP file for the function, MASTER_DEPARTMENT
 -                  :   
 -                  :   
 -                  :   
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2007/07/11   Ray Guo         1.0                 source is generated.
 -
 -
 -
--------------------------------------------------------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.setup.dept.vo.DeptHdrVo"%>
<%@ page import="com.erp.app.setup.dept.web.DeptSearchAction"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="deptSearchForm" scope="session" type="com.erp.app.setup.dept.web.DeptSearchForm" />

<%
ArrayList deptList = deptSearchForm.getResultList();
pageContext.setAttribute("deptList", deptList);
TableSchema ts = deptSearchForm.getTs();
TableSchema[] childTsList = deptSearchForm.getChildTs();
//TableSchema dtlChildTs = childTsList[DeptSearchAction.TAB_IDX_DTL];
%>

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>
	}

	function doEdit(val) {
		document.forms[0].editMaster_departmentCode.value = val;
		doSubmit('<%=deptSearchForm.ACTION_EDIT%>');
	}

</script>

<body onLoad="javascript:doLoad();autofill_init();">
<html:form action="/deptSearch">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>
<html:hidden property="editMaster_departmentCode"/>

<table class="table_top">

<tr>
	<td>
		<chtml:button form="deptSearchForm" pageEvent="<%=DeptSearchAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="deptSearchForm" pageEvent="<%=DeptSearchAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="deptSearchForm" pageEvent="<%=DeptSearchAction.ACTION_CLEAR%>"
			styleClass="button1"/>
		<chtml:button form="deptSearchForm" pageEvent="<%=DeptSearchAction.ACTION_CREATE%>"
			styleClass="button1"/>
		
	</td>
</tr>

<tr>
	<td>

		<table class="table_crit">

		<tr class="col_label"> 
			<td class="col_label">&nbsp;</td>
			<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_FROM");
				%>
				<%=webLabel%>
			</td>
			<td class="col_label_fr_to">
				<%
				webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_TO");
				%>
				<%=webLabel%>
			</td>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_DEPT_CODE");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text property="srchDeptCodeFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<td class="col_value">
				<html:text property="srchDeptCodeTo" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_DEPT_NAME");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="text" name="deptSearchForm" property="srchHdrDeptNameFr" readonly="<%=formReadOnly%>" />
			</td>
			<td class="col_value">				
			</td>
		</tr>
		<%--
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_GROUP_CODE");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text property="srchHdrGroupCodeFr" styleClass="textbox1" maxlength="<%=srchColSize%>" size="<%=srchDisplaySize%>"/>
			</td>
			<td class="col_value">
				
			</td>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_BRAND_CODE");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">				
				<html:text useExtensions="true" uiType="combobox" name="deptSearchForm" property="srchHdrBrandCodeFr" readonly="<%=formReadOnly%>" showCode="false"/>
			</td>
			<td class="col_value">
				
			</td>
		</tr>
		--%>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_STATUS");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="combobox" name="deptSearchForm" property="srchHdrStatus" readonly="<%=formReadOnly%>" showCode="false"/>
			</td>
			<td class="col_value">

			</td>
		</tr>
		<%--		
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_IS_US");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">				
				<html:text useExtensions="true" uiType="combobox" name="deptSearchForm" property="srchHdrIsUsFr" readonly="<%=formReadOnly%>" showCode="false"/>
			</td>
			<td class="col_value">				
			</td>
		</tr>
		<tr>
			<%
			webLabel = ts.getDisplayWebLabelWithColonByObjectId("LBL_SRCH_IS_MERCHANDISING_DEPARTMENT");
			%>
			<td class="col_label">
			<%=webLabel%>
			</td>
			<td class="col_value">
				<html:text useExtensions="true" uiType="combobox" name="deptSearchForm" property="srchHdrIsMerchandisingDepartmentFr" readonly="<%=formReadOnly%>" showCode="false"/>
				
			</td>
			<td class="col_value">
				
			</td>
		</tr>
		--%>

		</table>

	</td>
</tr>

<tr>
	<td><font color='red'><html:errors/></font></td>
</tr>

<tr>
	<td class="grid_page">
	<%if(deptSearchForm.getTotalPage() == 0 ) { %>
		&nbsp;
	<%} else { %>
		<input type="button" value="Go" class="button1" onClick="javascript:doSubmit('<%=deptSearchForm.ACTION_SCROLL_TO%>');" >
		Page
		<html:text property="scrollTo" styleClass="textbox1" readonly="<%=rowReadOnly%>" maxlength="4" size="4" value="<%=String.valueOf(deptSearchForm.getCurrentPage())%>"/>
		of <%=deptSearchForm.getTotalPage()%>
	<%} %>
		<input type="button" value="|&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=deptSearchForm.ACTION_SCROLL_TO_FIRST_PAGE%>');" <%=deptSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&lt;&lt;" class="button1" onClick="javascript:doSubmit('<%=deptSearchForm.ACTION_SCROLL_LEFT%>');" <%=deptSearchForm.getSidx() == 0 ? "disabled" : ""%>>
		<input type="button" value="&gt;&gt;" class="button1" onClick="javascript:doSubmit('<%=deptSearchForm.ACTION_SCROLL_RIGHT%>');" <%=deptSearchForm.getSidx() < Integer.parseInt(deptSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
		<input type="button" value="&gt;&gt|" class="button1" onClick="javascript:doSubmit('<%=deptSearchForm.ACTION_SCROLL_TO_LAST_PAGE%>');" <%=deptSearchForm.getSidx() < Integer.parseInt(deptSearchForm.getLastPageSidx()) ? "" : "disabled"%>>
	</td>
</tr>

</table>


<table class="table_grid">

	<tr class="grid_header">
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_DEPT_CODE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_DEPT_NAME");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%--
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_GROUP_CODE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_BRAND_CODE");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		--%>
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_STATUS");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%--
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_IS_US");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		<%
		webLabel = ts.getDisplayWebLabelByObjectId("LBL_GRID_IS_MERCHANDISING_DEPARTMENT");
		%>
		<td class="grid_header_col" nowrap>
			<%=webLabel%>
		</td>
		--%>
	</tr>

	<logic:iterate id="srchRsltRow" name="deptList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(deptSearchForm.getSidx())%>">

	<%
		DeptHdrVo row = (DeptHdrVo) srchRsltRow;
		String gridStyle = (idx.intValue()%2 == 0) ? "grid_result1" : "grid_result2";
	%>

	<% if(row != null) {%>

	<tr class="<%=gridStyle%>" onmouseover="mouseOverHighlight(event,'grid_row_action_hilite')"
	onmouseout="mouseOutHighlight('<%=gridStyle%>')"
	onclick="javascript:doEdit('<%=StringUtil.escapeSlash(row.getDeptCode(), "'") %>')">
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="write" name="srchRsltRow" property="deptCode" filter="true"/>&nbsp;
		</td>
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="write" name="srchRsltRow" property="hdrDeptName" filter="true"/>&nbsp;
		</td>
		<%--
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="write" name="srchRsltRow" property="hdrGroupCode" filter="true"/>&nbsp;
		</td>
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="srchRsltRow" property="hdrBrandCode" filter="true" showCode="false" visibility="displayOnly"/>&nbsp;
		</td>
		--%>
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="srchRsltRow" property="hdrStatus" filter="true" showCode="false" visibility="displayOnly"/>&nbsp;
		</td>
		<%--
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="srchRsltRow" property="hdrIsUs" filter="true" showCode="false" visibility="displayOnly"/>&nbsp;
		</td>
		<td class="grid_outline" nowrap>
			<html:text useExtensions="true" uiType="combobox" name="srchRsltRow" property="hdrIsMerchandisingDepartment" filter="true" showCode="false" visibility="displayOnly"/>&nbsp;
		</td>
		--%>
	</tr>

	<% } // end if(row != null) %>

	</logic:iterate>

</table>

</html:form>
